<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ReportDailyRun.aspx.cs" Inherits="ReportDailyRun" Title="ABC SuperSign - Users" %>
<%@ Register Src="UserAccess.ascx" TagName="UserAccess" TagPrefix="uc1" %>
<%@ Register Src="GlobalAjax.ascx" TagName="GlobalAjax" TagPrefix="uc2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="Microsoft.Web.Preview" Namespace="Microsoft.Web.Preview.UI.Controls" TagPrefix="cc2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder_Main" Runat="Server">
<form action="#" runat="server">
<asp:ScriptManager ID="ScriptManager_DailyRun" runat="server">
</asp:ScriptManager>
<uc1:UserAccess ID="UserAccess1" runat="server" />
<uc2:GlobalAjax ID="ctl_GlobalAjax" runat="server" />
<asp:HiddenField ID="ExportFileName" runat="server" Value="" />

<!-- page title start -->
<h1>
	<span>Reporting: Daily Run</span>
</h1>
<!-- page title end -->
<!-- Main Content start -->
<div class="mainHolder">
<!-- left block start -->
	<div class="leftBlock">
		<h2>
			<span>Report Parameters</span>
		</h2>
		<div class="innerContent">
			<asp:UpdatePanel ID="UpdatePanel_Parameters" runat="server">
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="DDList_Properties" EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="DDList_Clients" EventName="SelectedIndexChanged" />
                <asp:AsyncPostBackTrigger ControlID="TextBox_TimeFrom" EventName="TextChanged" />
                <asp:AsyncPostBackTrigger ControlID="TextBox_TimeTo" EventName="TextChanged" />
                <asp:AsyncPostBackTrigger ControlID="Btn_Reset" EventName="Click" />
            </Triggers>
            <ContentTemplate>
                <div class="row">
                    <asp:Label ID="Lbl_Alerts" runat="server" Visible="false" Text=""></asp:Label>
                    <asp:Label ID="Lbl_TimeFromAlert" runat="server" Visible="false" Text=""></asp:Label>
                    <asp:Label ID="Lbl_TimeToAlert" runat="server" Visible="false" Text=""></asp:Label>
                </div>
                <div class="row">
                    <div class="col">
				        <div class="col">
			                <label>Date Range</label>
                            <asp:TextBox ID="TextBox_DateFrom" runat="server" CssClass="aspDateBox"></asp:TextBox>
		                    <span>to</span>
                            <asp:TextBox ID="TextBox_DateTo" runat="server" CssClass="aspDateBox"></asp:TextBox>
				        </div>
				    </div>
				    <div class="col right">
			            <label>Time Range</label>
                        <asp:TextBox ID="TextBox_TimeFrom" runat="server" OnTextChanged="TextBox_TimeFrom_TextChanged" AutoPostBack="true"></asp:TextBox>
		                <span>to</span>
                        <asp:TextBox ID="TextBox_TimeTo" runat="server" OnTextChanged="TextBox_TimeTo_TextChanged" AutoPostBack="true"></asp:TextBox>
				    </div>
			    </div>
			    <div class="row">
                    <label>Property</label>
                    <asp:DropDownList id="DDList_Properties" runat="server" CssClass="widthM" AutoPostBack="True" OnSelectedIndexChanged="DDList_Properties_SelectedIndexChanged"></asp:DropDownList>
                </div>
                <div class="row">
                    <label>Client</label>
                    <asp:DropDownList id="DDList_Clients" runat="server" CssClass="widthM" AutoPostBack="True" OnSelectedIndexChanged="DDList_Clients_SelectedIndexChanged"></asp:DropDownList>
                </div>
                <div class="row">
                    <label>Channel</label>
                    <asp:DropDownList id="DDList_Channels" CssClass="widthM" runat="server" >
                    </asp:DropDownList>
                </div>
                <div class="row">
                    <label>Media Type</label>
                    <asp:DropDownList id="DDList_MediaTypes" runat="server" CssClass="widthM"></asp:DropDownList>
                </div>
			</ContentTemplate>
			</asp:UpdatePanel>
            <div class="row">
                <asp:Button ID="Btn_RunReport" runat="server" Text="Run Report" OnClick="Btn_RunReport_Click" OnClientClick="showProgress();"/>
                <div class="spacerS"></div>
                <asp:Button ID="Btn_Reset" runat="server" Text="Reset" OnClick="Btn_Reset_Click" />
            </div>
	    </div>
	</div>
<!-- left block end -->
<!-- right block start -->
    <div class="rightBlock">
        <asp:UpdatePanel ID="UpdatePanel_Results" runat="server" UpdateMode="Conditional" >
            <ContentTemplate>
                <h2>
                    <span>Results</span>
                    <asp:Button ID="Btn_ExportCSV" runat="server" Text="Export" CssClass="aspButton"
                        Enabled="false" OnClick="Btn_ExportCSV_Click" />
                    <asp:Button ID="Btn_Print" runat="server" Text="Print" CssClass="aspButton" Enabled="false" />
                </h2>
                <div class="innerContent" style="padding-bottom: 10px;">                                   
                        <asp:Label ID="Lbl_Messages" runat="server" Text=""></asp:Label>
                    <div class="reportResults">
                        <asp:Label ID="Lbl_ReportTitle" runat="server" Text="" Visible="false" Font-Bold="true" Font-Size="14px" ></asp:Label>
                        <asp:Label ID="Lbl_ClientName" runat="server" Text="" Visible="false" CssClass="reportHeader"></asp:Label>
                        <asp:GridView ID="GridView_Results" runat="server" CellPadding="4" GridLines="Both"
                            ShowFooter="True" AutoGenerateColumns="False">
                            <HeaderStyle Font-Size="13px" />
                            <%--<FooterStyle Font-Bold="True" Font-Size="13px" />--%>
                            <Columns>
                                <asp:BoundField DataField="Property" HeaderText="Property" />
                                <asp:BoundField DataField="Client" HeaderText="Client" />
                                <asp:BoundField DataField="Date" HeaderText="Date" />
                                <asp:BoundField DataField="Time" HeaderText="Time" />
                                <asp:BoundField DataField="Asset" HeaderText="Asset" />
                                <asp:BoundField DataField="Channel" HeaderText="Channel" />
                                <asp:BoundField DataField="Media Type" HeaderText="Media Type" />
                                <asp:BoundField DataField="Times Played" HeaderText="Times Played" />
                                <asp:BoundField DataField="Total Minutes" HeaderText="Total Minutes" />
                            </Columns>
                        </asp:GridView>
                    </div>
                </div>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="Btn_RunReport" EventName="Click"></asp:AsyncPostBackTrigger>
            </Triggers>
        </asp:UpdatePanel>
    </div>
    <!-- right block end -->
<!-- main content end -->
</div>
<!-- export csv popup begins -->
<asp:Panel ID="Panel_ExportCSV" runat="server" Width="300" CssClass="popupPanel">
<div id="exportCSVPopup" class="yesNoAlert">
    <strong>
        <span>Export Report</span>
        <a href="#" class="close">Close</a>
    </strong>
    <div class="inner">
	    <a id="exportCSVLink" href="#" visible="false">Download Word File</a>
	    <br />
    </div>
</div>
</asp:Panel>
<cc2:DragOverlayExtender ID="DragOverlayExtender_ExportCSV" TargetControlID="Panel_ExportCSV" runat="server" Enabled="true" />
<cc1:DropShadowExtender ID="DropShadowExtender_ExportCSV" runat="server"
    TargetControlID="Panel_ExportCSV" 
    Rounded="false"
    Width="5"
    Opacity="0.25" 
    TrackPosition="true"  />
<!-- export csv popup ends -->
<script type="text/javascript">
	function showExportPopup() {
	    var filePath = "Exports" + "\/" + "<%= ExportFileName.Value %>";
        $('exportCSVLink').setAttribute('href', filePath);
        $('exportCSVPopup').style.display = "block";
    }
    
    function showProgress() {
        var msgLabel = $('<%= Lbl_Messages.ClientID %>');
        if (msgLabel) {
            msgLabel.text = "Please wait.  Attempting to retrieve report results...";
            msgLabel.style.display = "block";
        }
    }

</script>
</form>

</asp:Content>

